package com.freesky.biz.abchina.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.freesky.biz.abchina.domain.LifepayBillEntity;
import com.freesky.biz.abchina.domain.LifepayOrderEntity;
import com.freesky.biz.abchina.domain.TLoanRecord;
import com.freesky.biz.abchina.mapper.LifepayBillMapper;
import com.freesky.biz.abchina.mapper.LoanRecordMapper;
import com.freesky.biz.abchina.service.ILifepayBillService;
import com.freesky.biz.abchina.service.ILoanRecordService;
import com.freesky.biz.rights.domain.RightsBusiEntity;
import com.freesky.biz.rights.mapper.RightsBusiMapper;
import com.freesky.biz.rights.service.IRightsBusiService;
import com.freesky.biz.utils.SeqUtil;
import com.freesky.common.core.domain.AjaxResult;
import com.freesky.common.core.domain.entity.SysUser;
import com.freesky.common.enums.ExportStatusEnum;
import com.freesky.common.utils.SecurityUtils;
import com.freesky.system.domain.TExportRecord;
import com.freesky.system.service.ITExportRecordService;
import com.freesky.system.task.SyncReport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Map;

@Service
public class LifepayBillServiceImpl extends ServiceImpl<LifepayBillMapper, LifepayBillEntity> implements ILifepayBillService  {

    @Override
    public List<Map<String, Object>> selectLifepayBillMaps(String billDate) {
        QueryWrapper<LifepayBillEntity> wrapper = new QueryWrapper<>();
        wrapper.eq("trade_date", billDate)
                .select("SUM(payment_amount) AS sumPaymentAmount",
                        "sum(refund_amount) As sumRefundAmount",
                        "pay_refund_flag")
                .groupBy("pay_refund_flag");
        return listMaps(wrapper);
    }

}
